package com.springcloud.demo.producer;

import com.springcloud.demo.channel.MyDefaultSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Component;

@Component
@EnableBinding(MyDefaultSource.class)
public class MessageDefaultProducer {

    @Autowired
    private MyDefaultSource source;

    public void send(String message){
        source.defaultOutput().send(MessageBuilder.withPayload(message).build());

    }
}
